package tenth.通配符.受限泛型;

/**
 * 当使用的泛型只能在本类及其父类类型应用时，就必须使用泛型的下限进行配置
 */
public class 泛型的下限 {
    public static void main(String[] args) {
        Info<Object> i1 = new Info<Object>();
        Info<String> i2 = new Info<>();
        i1.setVar(new Object());
        i2.setVar("李四");
        fun(i1);
        fun(i2);

    }

    public static void fun(Info<? super String> temp) {  // 只能接收String或者Objecct类型的泛型
        System.out.println("内容：" + temp);
    }
}
/*
D:\WorkSpaces\Java\jdk-21\bin\java.exe "-javaagent:D:\Software\IntelliJ IDEA\IntelliJ IDEA 2023.3.2\lib\idea_rt.jar=53686:D:\Software\IntelliJ IDEA\IntelliJ IDEA 2023.3.2\bin" -Dfile.encoding=UTF-8 -Dsun.stdout.encoding=UTF-8 -Dsun.stderr.encoding=UTF-8 -classpath D:\WorkSpaces\JavaDevelopBase_start_329\out\production\JavaDevelopBase_start_329 tenth.通配符.受限泛型.泛型的下限
内容：java.lang.Object@2f4d3709
内容：李四

Process finished with exit code 0

 */